function q = myfft(filename)

Fs = 1000;                    % Sampling frequency
T = 1/Fs;                     % Sample time
L = 1000;                     % Length of signal
t = (0:L-1)*T;                % Time vector
% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid

y = loadandplot(filename);
subplot(2,1,1);
plot(1:800,y(1:800,1:50))
title(filename)
xlabel('time (milliseconds)')

F= []
for i=1:50
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y(1:800,i),NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
F=[F,2*abs(Y(1:NFFT/2+1))];
end

% Plot single-sided amplitude spectrum.
subplot(2,1,2);
plot(f,F) ;
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')